package DSLS

class EmailDsl {

    String toText
    String fromText
    String body

    static void main(String[] args) {
        def emailDsl=new EmailDsl();
        emailDsl.make{
            to "Nirav Assar"
            from "Barack Obama"
            body "How are things? We are doing well. Take care"
        }
    }

    def static make(closure) {
        EmailDsl emailDsl = new EmailDsl()
        closure.delegate = emailDsl
        closure()
    }

    def to(String toText) {
        this.toText = toText
    }

    def from(String fromText) {
        this.fromText = fromText
    }

    def body(String bodyText) {
        this.body = bodyText
    }

}



